﻿using System;
using System.Collections.Generic;
using Luna.Data.Configuration;

namespace Luna.Data.CRM
{
    public class ContactProvider : LunaDataProvider, IContactProvider
    {
        public AccountDataMapper AccountMapper { get; set; }

        public CategoryDataMapper CategoryMapper { get; set; }

        public ContactDataMapper ContactMapper { get; set; }

        public void AccountDelete(IReferenceData company)
        {
            WrapperTransactional(T => AccountMapper.Delete(T, company.PK));
        }

        public void AccountDelete(IEnumerable<IAccountData> accounts)
        {
            throw new NotImplementedException();
        }

        public IAccountData AccountGet(IReferenceData companyID)
        {
            return WrapperTransactional(T => AccountMapper.Get(T, companyID.PK));
        }

        public IEnumerable<IAccountData> AccountGetAll()
        {
            return WrapperTransactional(T => AccountMapper.GetAll(T));
        }

        public void AccountSave(IAccountData company)
        {
            WrapperTransactional(T =>
            {
                company.LastUpdate = DateTime.Now;
                AccountMapper.Save(T, company);
            });
        }

        public void AccountSave(IEnumerable<IAccountData> accounts)
        {
            throw new NotImplementedException();
        }

        public void CategoryDelete(IReferenceData categoryID)
        {
            WrapperTransactional(T => CategoryMapper.Delete(T, categoryID.PK));
        }

        public ICategoryData CategoryGet(IReferenceData categoryID)
        {
            return WrapperTransactional(T => CategoryMapper.Get(T, categoryID.PK));
        }

        public IEnumerable<ICategoryData> CategoryGetAll()
        {
            return WrapperTransactional(T => CategoryMapper.GetAll(T));
        }

        public void CategorySave(ICategoryData category)
        {
            WrapperTransactional(T =>
            {
                category.LastUpdate = DateTime.Now;
                CategoryMapper.Save(T, category);
            });
        }

        public void ContactDelete(IReferenceData contact)
        {
            throw new NotImplementedException();
        }

        public void ContactDelete(IEnumerable<IContactData> contact)
        {
            throw new NotImplementedException();
        }

        public IContactData ContactGet(IReferenceData contactID)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IContactData> ContactGetAll()
        {
            throw new NotImplementedException();
        }

        public void ContactSave(IContactData contact)
        {
            throw new NotImplementedException();
        }

        public void ContactSave(IEnumerable<IContactData> contacts)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IContactData> ContactGetAllByAccount(IReferenceData accountID)
        {
            throw new NotImplementedException();
        }
    }
}